package com.ktjy.service.impl;

import com.ktjy.mapper.StorageRecordMapper;
import com.ktjy.pojo.StorageRecord;
import com.ktjy.service.StorageRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.swing.*;
import java.util.List;

@Transactional
@Service
public class StorageRecordServiceImpl implements StorageRecordService {
    @Autowired
    StorageRecordMapper storageRecordMapper;

    @Override
    public int count(Long supplierId, Integer payStatus, String goodsName) {
        int count = storageRecordMapper.count(supplierId, payStatus, goodsName);
        return count;
    }

    @Override
    public List<StorageRecord> getPageStorageRecord(Long supplierId, Integer payStatus, String goodsName, Integer pageNo, Integer pageSize) {
        List<StorageRecord> list = storageRecordMapper.getPageStorageRecord(supplierId, payStatus, goodsName, (pageNo - 1) * pageSize, pageSize);
        return list;
    }

    @Override
    public StorageRecord getById(Integer id) {
        StorageRecord byId = storageRecordMapper.getById(id);
        return byId;
    }

    @Override
    public int insert(StorageRecord storageRecord) {
        int insert = storageRecordMapper.insert(storageRecord);
        return insert;
    }

    @Override
    public int update(StorageRecord storageRecord) {
        int update = storageRecordMapper.update(storageRecord);
        return update;
    }

    @Override
    public int delete(Integer id) {
        int delete = storageRecordMapper.delete(id);
        return delete;
    }
}
